﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Objects;

namespace Fdd.Aspen.Test.Infrastructure
{
    class TestObjectSet<T> : IObjectSet<T> where T : class
    {
        private List<T> _items = new List<T>();

        public void AddObject(T entity)
        {
            _items.Add(entity);
        }

        public void Attach(T entity)
        {
        }

        public void DeleteObject(T entity)
        {
            _items.Remove(entity);
        }

        public void Detach(T entity)
        {
        }

        public IEnumerator<T> GetEnumerator()
        {
            return _items.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return _items.GetEnumerator();
        }

        public Type ElementType
        {
            get { return typeof(T); }
        }

        public System.Linq.Expressions.Expression Expression
        {
            get { return null; }
        }

        public IQueryProvider Provider
        {
            get { return null; }
        }
    }
}
